package com.xx.pmis.web.util;

import java.util.Comparator;

import com.xx.pmis.model.Shop;

public class ComparatorShop implements Comparator<Object> {

	public int compare(Object arg0, Object arg1) {
		Shop shop0 = (Shop) arg0;
		Shop shop1 = (Shop) arg1;

		// 首先比较购买次数，如果购买次数相同，则比较商店编码
        
		int flag = (String.valueOf(shop0.getBuyNum())).compareTo(String.valueOf(shop1.getBuyNum()));
		if (flag == 0) {
			return shop0.getShopCode().compareTo(shop1.getShopCode());
		} else {
			return flag;
		}
	}

}